<?php 
  $currentpage=$_POST['currentpage'];
  $pageSize=$_POST['pageSize'];
  $offset=($currentpage-1)*$pageSize;

  include_once "../../common/sql.php";
  $conn=connect();
  $sql="select c.content,c.author,c.created,c.id,c.status,p.title from comments c
    left join posts p on p.id=c.post_id
    limit $offset,$pageSize";
   $bool=query($conn,$sql);
   $arr="select count(*) count from comments";
    $count=query($conn,$arr)[0]['count'];

   $res=["code"=>0,"msg"=>'请求失败'];

  if($bool){
  	  $res['code']=1;
  	  $res['msg']='请求成功';
  	  $res['data']=$bool;
  	  $res['count']=$count;
  }
 echo json_encode($res);
 ?>